home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
cprog.EXE
/
CC_1.ZIP
/
GETS.C
< prev
next >
Wrap
Text File
|
1988-02-01
|
512b
|
24 lines
/*
** get a string from "stdin"
** terminate with \0
*/
extern int *stdin, fgetc();
gets(s) char *s; {
int n, ch;
char *str;
str=s; /* save original value */
n = 256;
while(--n) {
ch=fgetc(stdin);
if(ch<0) {
*s='\0';
return 0;
}
if(ch=='\n') break;
*s++=ch;
}
*s='\0';
return str;
}